package com.easylinkin.linkappapi.devicemanager.controller;

import com.baomidou.mybatisplus.extension.api.ApiController;
import com.easylinkin.linkappapi.common.model.RequestModel;
import com.easylinkin.linkappapi.devicemanager.service.WireropeService;
import com.easylinkin.linkappapi.devicemanager.vo.WireropeVo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import site.morn.rest.RestBuilders;
import site.morn.rest.RestMessage;

import javax.annotation.Resource;

/**
 * @author linWenLe
 * @Date: 2024/3/27
 * @Description: 巡检
 */
@RestController
@RequestMapping("/wirerope")
public class WireropeController extends ApiController {

    @Resource
    private WireropeService wireropeService;

    /***
     * 获取钢丝绳信息
     * @return
     */
    @RequestMapping("getWireropeInfo")
    public RestMessage getWireropeInfo(String deviceId) {
        return RestBuilders.successBuilder(wireropeService.getWireropeInfo(deviceId)).build();
    }

    /***
     * 获取历史预警数据
     * @return
     */
    @PostMapping("getHistoryAlertList")
    public RestMessage getHistoryAlertList(@RequestBody RequestModel<WireropeVo> restPage) {
        return RestBuilders.successBuilder(wireropeService.getHistoryAlertList(restPage)).build();
    }

    /***
     * 获取钢丝绳数据
     * @return
     */
    @PostMapping("getWireropeList")
    public RestMessage getWireropeList(@RequestBody WireropeVo entity) {
        return RestBuilders.successBuilder(wireropeService.getWireropeList(entity)).build();
    }

    /***
     * 设备列表
     * @return
     */
    @RequestMapping("deviceList")
    public RestMessage deviceList() {
        return RestBuilders.successBuilder(wireropeService.deviceList()).build();
    }
}
